Bivariate normal distribution

This is an example on how to use R and plotly to draw a 3d function

library(mnormt)
library(plotly)

x     <- seq(-3, 3, 0.1) 
y     <- seq(-3, 3, 0.1)
mu    <- c(0, 0)
sigma <- matrix(c(1, 0, 0, 1), nrow=2)
f     <- function(x, y) dmnorm(cbind(x, y), mu, sigma)
z     <- outer(x, y, f)

plot_ly(z = z, x=x, y=y , type = "surface")